package uvt.map.graph;

import java.util.ArrayList;

import org.openstreetmap.gui.jmapviewer.Coordinate;

import uvt.map.JMapViewer;
import uvt.map.graph.element.Segment;
import uvt.map.graph.element.Street;
import uvt.map.graph.element.Vehicle;
import uvt.map.mapmarker.MapPolygonImpl;

public class Vertex implements Drawable {
	
	private Vehicle with;
	private Street street;
	
	public Vertex(Vehicle vehicle,Street street) {
		this.with = vehicle;
		this.street = street;
	}
	
	public void draw(JMapViewer map) {
		for(Segment seg : street.getListSegments()) {
			MapPolygonImpl.setPolygonColor(with.getColor());
			ArrayList<Coordinate> list = new ArrayList<Coordinate>();
	    	list.add(new Coordinate(seg.getxA(),seg.getyA()));
	    	list.add(new Coordinate(seg.getxA(),seg.getyA()));
	    	list.add(new Coordinate(seg.getxB(),seg.getyB()));
	    	list.add(new Coordinate(seg.getxB(),seg.getyB()));
	    	//map.addMapPolygon(new MapPolygonImpl(street.getName(),list));
	    	map.addMapPolygon(new MapPolygonImpl("",list));
		}
	}

	public Vehicle getWith() {
		return with;
	}

	public void setWith(Vehicle with) {
		this.with = with;
	}

	public Street getStreet() {
		return street;
	}

	public void setStreet(Street street) {
		this.street = street;
	}

}